Many libxl functions erroneously return "-1" on error, rather than
some ERROR_* value.
To deal with this, invent a new ERROR_NONSPECIFIC "-1" which indicates
that "the function which generated this error code is broken".
Fix up the one we care about for forthcoming duplicate domain
detection (libxl_name_to_domid) and the others following the same
pattern nearby; leave the rest for post-4.1.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Acked-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
} libxl_domain_suspend_info;
enum {
- ERROR_VERSION = -1,
- ERROR_FAIL = -2,
- ERROR_NI = -3,
- ERROR_NOMEM = -4,
- ERROR_INVAL = -5,
- ERROR_BADFAIL = -6,
+ ERROR_NONSPECIFIC = -1,
+ ERROR_VERSION = -2,
+ ERROR_FAIL = -3,
+ ERROR_NI = -4,
+ ERROR_NOMEM = -5,
+ ERROR_INVAL = -6,
+ ERROR_BADFAIL = -7,
};
#define LIBXL_VERSION 0
int i, nb_domains;
char *domname;
libxl_dominfo *dominfo;
- int ret = -1;
+ int ret = ERROR_INVAL;
dominfo = libxl_list_domain(ctx, &nb_domains);
if (!dominfo)
int i, nb_pools;
char *poolname;
libxl_cpupoolinfo *poolinfo;
- int ret = -1;
+ int ret = ERROR_INVAL;
poolinfo = libxl_list_cpupool(ctx, &nb_pools);
if (!poolinfo)
if (strcmp(name, schedid_name[i].name) == 0)
return schedid_name[i].id;
- return -1;
+ return ERROR_INVAL;
}
char *libxl_schedid_to_name(libxl_ctx *ctx, int schedid)
} else if (!strcmp(s, "tap")) {
p = strchr(s, ':');
if (!p) {
- rc = -1;
+ rc = ERROR_INVAL;
goto out;
}
p++;